/*******************************************************************************
*
*   FILE NAME:
*       TimeSpan.cpp - TimeSpan class implementation
*
*   DESCRIPTION:
*       Represents a time interval.
*
*******************************************************************************/
#include "TimeSpan.h"

TimeSpan::TimeSpan( void )
    : mTicks( 0 )
{
}

TimeSpan::TimeSpan( uint64 ticks )
    : mTicks( ticks )
{
}

TimeSpan::TimeSpan( const TimeSpan& other )
    : mTicks( other.mTicks )
{
}

TimeSpan::~TimeSpan( void )
{
}

TimeSpan& TimeSpan::operator=( const TimeSpan& other )
{
    mTicks = other.mTicks;
    return *this;
}

uint32 TimeSpan::GetDays( void )
{
    return uint32( mTicks / TicksPerDay );
}

uint32 TimeSpan::GetHours( void )
{
    return uint32( ( mTicks % TicksPerDay ) / TicksPerHour );
}

uint32 TimeSpan::GetMinutes( void )
{
    return uint32( ( mTicks % TicksPerHour ) / TicksPerMinute );
}

uint32 TimeSpan::GetSeconds( void )
{
    return uint32( ( mTicks % TicksPerHour ) / TicksPerSecond );
}

uint32 TimeSpan::GetMilliseconds( void )
{
    return uint32( ( mTicks % TicksPerSecond ) / TicksPerMillisecond );
}

uint64 TimeSpan::GetTicks( void )
{
    return mTicks;
}

float64 TimeSpan::GetTotalDays( void )
{
    return float64( mTicks ) / float64( TicksPerDay );
}

float64 TimeSpan::GetTotalHours( void )
{
    return float64( mTicks ) / float64( TicksPerHour );
}

float64 TimeSpan::GetTotalMinutes( void )
{
    return float64( mTicks ) / float64( TicksPerMinute );
}

float64 TimeSpan::GetTotalSeconds( void )
{
    return float64( mTicks ) / float64( TicksPerSecond );
}

float64 TimeSpan::GetTotalMilliseconds( void )
{
    return float64( mTicks ) / float64( TicksPerMillisecond );
}
